Replication File for "Explaining Criminal Fragmentation: Evidence from Mexico" 

By Jane Esberg (jesberg@sas.upenn.edu)


** Notes **

Last run by authors on macOS Sonoma 14.6.1
Rstudio verison 2023.09.0+463 
Running R version 4.3.1 Beagle Scouts

R version 4.3.1 (2023-06-16)Platform: aarch64-apple-darwin20 (64-bit)Running under: macOS 15.2Matrix products: defaultBLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0locale:[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8time zone: America/New_Yorktzcode source: internalattached base packages:[1] stats     graphics  grDevices utils     datasets  methods  [7] base     other attached packages: [1] RColorBrewer_1.1-3  sf_1.0-14           extrafont_0.19      [4] gridExtra_2.3       DIDmultiplegt_0.1.0 dplyr_1.1.4         [7] plyr_1.8.8          stringi_1.7.12      stringr_1.5.0      [10] did_2.1.2           bacondecomp_0.1.1   this.path_1.4.0    [13] fixest_0.11.2       stargazer_5.2.3     broom_1.0.4        [16] tidyr_1.3.0         ggplot2_3.4.4       plm_2.6-3          [19] lmtest_0.9-40       zoo_1.8-12         loaded via a namespace (and not attached): [1] gtable_0.3.3        rstatix_0.7.2       collapse_1.9.6      [4] lattice_0.21-8      numDeriv_2016.8-1.1 sampling_2.9        [7] vctrs_0.6.5         tools_4.3.1         Rdpack_2.4         [10] generics_0.1.3      parallel_4.3.1      sandwich_3.0-2     [13] proxy_0.4-27        tibble_3.2.1        fansi_1.0.6        [16] pacman_0.5.1        pkgconfig_2.0.3     KernSmooth_2.23-21 [19] data.table_1.14.8   assertthat_0.2.1    lifecycle_1.0.4    [22] compiler_4.3.1      maxLik_1.5-2        munsell_0.5.0      [25] carData_3.0-5       class_7.3-22        Rttf2pt1_1.3.12    [28] Formula_1.2-5       extrafontdb_1.0     pillar_1.9.0       [31] car_3.1-2           ggpubr_0.6.0        MASS_7.3-60        [34] classInt_0.4-9      abind_1.4-5         nlme_3.1-162       [37] tidyselect_1.2.1    bdsmatrix_1.3-6     digest_0.6.31      [40] purrr_1.0.2         miscTools_0.6-28    grid_4.3.1         [43] colorspace_2.1-0    cli_3.6.2           magrittr_2.0.3     [46] utf8_1.2.4          e1071_1.7-13        withr_3.0.0        [49] dreamerr_1.2.3      scales_1.2.1        backports_1.4.1    [52] plotrix_3.8-2       ggsignif_0.6.4      lpSolve_5.6.18     [55] rbibutils_2.2.13    rlang_1.1.4         Rcpp_1.0.11        [58] DBI_1.1.3           glue_1.7.0          BMisc_1.4.5        [61] rstudioapi_0.14     R6_2.5.1            units_0.8-2        


Working Directory will be automatically be set to location of replication folder when code files are run. 

muni_2012gw will download as a .zip file due to size, and must be unzipped to reproduce maps.

** Variables & Data Sources

** Input Data **
'mx_panel.csv' - collection of merged control and outcome variables
'criminal_groups.csv' - municipality-year level information on the number of criminal groups
gas_prices_annual_mexico.csv - annual gas prices in Mexico, for appendix figure
tomas_by_year_pemex.csv - annual tomas in Mexico, for appendix figure
muni_2012gw -- shape files for maps of Mexico. This will download as a .zip file due to size, and must be unzipped to reproduce maps.


** Additional replication datasets**
'unique_groups_names_23.csv' - coded group-level information
'group_presence_by_year.csv' - raw group-year data


*************Criminal group variables*************
unique_groups: number of groups of any type present in a municipality-year according to coding rules.
dominant: number of dominant groups present in a municipality-year according to coding rules.

splinters: number of splinters present in a municipality-year according to coding rules.
cells: number of cells present in a municipality-year according to coding rules.
cells: number of unaffiliated groups present in a municipality-year according to coding rules.
expansion; dominant_expansion; splinters_expansion; cells_expansion; unaffiliated_expansion: number of existing groups of the specified type operating in a new municipality in a year.
emergence; dominant_ emergence; splinters_e emergence; cells_ emergence; unaffiliated_ emergence: number of new groups of the specified type operating in a municipality in a year.
umbrella: number of umbrella groups operating in a municipality-year.
affiliated: alternate construction of group differences, counting cells and splinters operating in a municipality-year.
non-dominant: alternate construction of group differences, counting cells, splinters, and unaffiliated groups operating in a municipality-year.
splinter_alt, cell_alt: in the body of the paper, a group that broke from another is counted as a splinter. This variable instead treats those groups as cells.
unique_groups_nobf; dominant_nobf; splinters_nobf; cells_nobf; unaffiliated_nobf: Version of the data where presence is not backfilled (e.g., where a group operating in the same municipality in 2017 and 2019 is not counted as also having been present in 2018).
unique_groups_m10; dominant_m10; splinters_m10; cells_m10; unaffiliated_m10: number of existing groups of the specified type with at least ten mentions, to weed out smaller groups.
corroborated; splinters_corroborated; cells_corroborated; unaffiliated_corroborated: number of groups of each type whose existence could be corroborated outside Borderland Beat.
kingpin_tr: main treatment variable for kingpin attacks (see document for coding rules)
kingpin_tr_yof: alternative treatment variable including a municipality as treated only if the kingpin-affected group was present year-of.
kingpin_tr_on: alternative treatment variable that does not turn 'off' three years post kingpin attack (instead, it stays on after the first time a group present was affected by a kingpin removal).
kingpin_tofrom: if a municipality experienced a kingpin removal, marks years to and from removal.



*************Panel variables**********************
inegi- municipal code from INEGI
year- year of panel
CVE_ENT- state code
CVE_MUN-municipality code
muni_id-unique state-municipality name ID
NOM_EST - name of state
NOM_MUN - name of municipality
POBTOT - population estimate. Taken from 2000 census for 2009; 2010 census for 2010-2014; 2015 CONEVAL population estimate for 2015-2020
POBMAS - male population. Taken from 2000 census for 2009; 2010 census otherwise.
homicides - count of homicides (municipio de ocurrencia) in municipality. From INEGI https://www.inegi.org.mx/sistemas/olap/proyectos/bd/continuas/mortalidad/defuncioneshom.asp?s=est 
indigenous_pop - percent of the population identified as indigenous. Taken from 2000 census for 2009; 2010 census otherwise.
illiteracy - percent of the over-15 population who cannot read. Taken from 2000 census for 2009; 2010 census otherwise.
employed - percent of adults in the workforce who are employed. Taken from 2000 census for 2009; 2010 census otherwise.
piso_de_tierra - percent of dwellings with earthen floor. Taken from 2000 census for 2009; 2010 census otherwise.
electricity - percent of dwellings with electricity. Taken from 2000 census for 2009; 2010 census otherwise.
amapola_kghec - measure of poppy seizures by municipality, kilogram per hectare eradicated. From Rafael Ch Duran, "Going Local"; created through petitions to information portal Infomex.
mariguana_kghec - measure of marijuana seizures by municipality. From Rafael Ch Duran, "Going Local"; created through petitions to information portal Infomex.
length_all - length of all current pipelines by municipality (in KM). 
length_pre - length of pipelines built before 2006 by municipality (in KM)
dist_vector_all - distance between nearest pipeline and the municipality (in KM).
inflation_adjusted_price_pesos: inflation adjusted cost of gas nationally in Mexico. 
dist_vector_pre - distance between nearest pipeline built pre-2006 and the municipality (in KM).
pan - whether a municipality had a PAN mayor. From https://github.com/emagar/elecRetrns.  
BLEYVA, CGOLFO, CJNG, CJUAREZ, CSINALOA, CTEMP, CTIJUANA, FMICH, ZETAS: variables showing group presence from Sobrino (2020) for, respectively, the Beltran Levy's; Gulf Cartel, CJNG; Juarez Cartel; Sinaloa Cartel; Caballeros Templarios; Familia Michoacana; and Zetas.
tot_sob: total number of groups counted by Sobrino (2020)
osorio_num_groups: total groups counted by Osorio and Beltran (2020)
guac_num_groups: Guacamaya leaks groups counted

NB: Census variables from INEGI https://www.inegi.org.mx/programas/ccpv/2010/; https://www.inegi.org.mx/programas/ccpv/2000/
CONEVAL: from UNDP https://www.undp.org/sites/g/files/zskgke326/files/2022-08/Poblacion%20CONEVAL.xlsx


***********Coded group information******

For full transparency, I additionally include my coding for group-level information
group: name of group
alternate_name, alternate_name2, alternate_name3, alternate_name4: any alternate group names
part_of: if group was/is a cell of a larger organization, which organization
splinter: if group broke off from a larger organization, which organization
broad_type: criminal, revolutionary, or self-defense. Only criminal groups included in the analysis.
dominant_group: if a group can be classified as a major organization according to coding rules. 
bb_only: whether the group could not be corroborated outside BorderlandBeat
notes: additional information about the organization
Sources: at least one source consulted outside Borderland Beat.


***********Group presence by year******

For full transparency, I additionally include group names and where they operated across time and space. Variables:

group: name of group
region_name: if named in a region (rather than a specific municipality), noted here.
year: year of mention
CVE_ENT: state code
CVE_MUN: municipality code
NOM_MUN: Name of municipality
state: Name of state







